package com.ybkj.o2o.zhuanche.service;

import java.util.Date;
import java.util.List;
import java.util.Map;

import com.ybkj.o2o.zhuanche.common.CompanyOrderVo;
import com.ybkj.o2o.zhuanche.common.DriverOrderDetailVo;
import com.ybkj.o2o.zhuanche.common.DriverOrderVo;
import com.ybkj.o2o.zhuanche.common.MemberOrderVo;
import com.ybkj.o2o.zhuanche.common.OrderFromSourceVo;
import com.ybkj.o2o.zhuanche.common.PageVo;
import com.ybkj.o2o.zhuanche.common.chart.HourChart;
import com.ybkj.o2o.zhuanche.common.query.OrderQuery;
import com.ybkj.o2o.zhuanche.entity.ChartDay;
import com.ybkj.o2o.zhuanche.entity.ChartMonth;
import com.ybkj.o2o.zhuanche.entity.ChartYear;
import com.ybkj.o2o.zhuanche.entity.Order;
import com.ybkj.o2o.zhuanche.entity.OrderCriteria;

public interface OrderService extends BaseService<Order, OrderCriteria, Long> {

  Order queryOneOrder(Long orderId, String appKey);

  Order findByIdAndAppKey(Long orderId, String appKey);

  Long countByParam(OrderQuery orderQuery);

  long countForToday(String appKey);

  List<Order> findByEmployId(OrderQuery orderQuery);

  ChartYear dataForYear(Integer year, Long companyId, String appKey);

  ChartMonth dataForMonth(Integer year, Integer month, Long companyId, String appKey);

  ChartDay dataForChartDay(Integer year, Integer month, int day, Long companyId, String appKey);

  HourChart dataForhour(Integer year, Integer month, Integer day, int hour, Long companyId,
      String appKey);

  PageVo<OrderFromSourceVo> orderFromSource(Date date1, Date date2, Long companyId, String appKey);

  List<Order> findHastenOrder(String appKey);

  Order findByDriverAndFinishTime(Long employId, Date start, Date end, String appKey);

  List<Order> findMonthOrder(Integer year, Integer month, String appKey);

  PageVo<MemberOrderVo> findMemberOrder(
      Date startTime, Date endTime, Long companyId, String appKey);


  PageVo<DriverOrderVo> driverAchievement(Date date1, Date date2, Long empCompanyId, String appKey);

  PageVo<CompanyOrderVo> companyOrder(Date date1, Date date2, String appKey);

  int addmore(Order order);

  PageVo<DriverOrderDetailVo> driverOrderDetailVo(Long driverId, Date start, Date end,
      Integer page, Integer rows, String appKey);


  List<Order> findMyFinishOrder(OrderQuery orderQuery);

  Long queryRunOrder(OrderQuery orderQuery);

  Long countRunningOrder(Long carTypeId, String appKey);

  List<Order> findByParams(OrderQuery orderQuery);
  
  List<Order> findByParamsInBook(OrderQuery orderQuery);
  
  Long countByParamsInBook(OrderQuery orderQuery);

  List<Order> queryByParams(OrderQuery orderQuery);

  List<Order> exportOrders(OrderQuery orderQuery);

  Long countByParams(OrderQuery orderQuery);

  List<Order> queryFinishOrder(OrderQuery orderQuery);
  
  List<Order> selectFinishOrder(OrderQuery orderQuery);

  Long countFinishOrder(OrderQuery orderQuery);
  
  Long countFinishOrderByEmploy(OrderQuery orderQuery);

  int prepare(Long orderId, String appKey);

  Map<String, Object> countFinishByCompay(Long companyId, Date startTime, Date endTime,
      String appKey);

  Long countRunByCompany(Long companyId, Date startTime, Date endTime, String appKey);

  Map<String, Object> countFinishByNotCompay(Long companyId, Date startTime, Date endTime,
      String appKey);

  Long countRunByNotCompany(Long companyId, Date startTime, Date endTime, String appKey);

  Long countCancelByCompany(Long companyId, Date startTime, Date endTime, String appKey);

  Map<String, Object> countFinishByNotCompanyAndDriver(Long companyId, Date startTime,
      Date endTime, String appKey);

  Long countRunByNotCompanyNotDriver(Long companyId, Date startTime, Date endTime, String appKey);


  long countCancelAll(Date startTime, Date endTime, String appKey);

  Map<String, Object> countMain(Date startTime, Date endTime, String appKey);

  long countByAppKey(Date startTime, Date endTime, String appKey);

  Long driverOrderDetailCount(OrderQuery orderQuery);

  List<Map<String,Object>> countOrderNumByDriver(Long[] driverIds, Date start, Date end, String appKey);

  Map<String,Object> countOnDutyByDriver(Long driverId, Date start, Date end);
  
  List<Map<String,Object>> countBookDriver(Long zhuanYuyueMax,Date zhuanYuyueTime,String appKey);
  
  List<Map<String,Object>> findDriverBusy(Long zhuanYuyueMax,Date zhuanYuyueTime,String appKey,Long employId);
  
  List<Map<String,Object>> countBusyBookDriver(Date zhuanYuyueTime,String appKey);
  
  Integer getTodayBooks(Long employId,Date start,Date end);
}
